


public class ThreadDemo31 {
    public static void main(String[] args) {
        Object locker1 = new Object();
        Object locker2 = new Object();
        synchronized (locker1) {
            synchronized (locker2) {

            }
        }
        synchronized (locker2) {
            synchronized (locker1) {

            }
        }
    }
}
